import { createRequestTypes } from '@UTILS/reduxHelper'
import {
  BotInputParamsITF,
  SmartAssistantBotInputActionITF, SmartAssistantQuestionActionITF,
  SmartAssistantStartEvaluationActionITF, SmartAssistantStartJourneyActionITF
} from '@REDUXITF/smartAssistant'
import { ChoiceITF, EvaluationITF } from '@INTERFACES/Survey'
import { AssistantMsgITF } from '@INTERFACES/SmartAssistant'
import { SCENARIO_ENUM } from '@CONSTANTS/smartAssistant'

export const BOT_START_JOURNEY = createRequestTypes('BOT_START_JOURNEY')
export const BOT_INPUT = createRequestTypes('BOT_INPUT')
export const BOT_START_EVALUATION = createRequestTypes('BOT_START_EVALUATION')
export const BOT_ANSWER_QUESTION = createRequestTypes('BOT_ANSWER_QUESTION')
export const BOT_EDIT_ANSWER_QUESTION = createRequestTypes('BOT_EDIT_ANSWER_QUESTION')

export default {
  dispatchStartJourney(scenario: SCENARIO_ENUM): SmartAssistantStartJourneyActionITF {
    return {
      type: BOT_START_JOURNEY.REQUEST,
      scenario
    }
  },
  dispatchBotInput(data: BotInputParamsITF): SmartAssistantBotInputActionITF {
    return {
      type: BOT_INPUT.REQUEST,
      data
    }
  },
  dispatchStartEvaluation(data: EvaluationITF, isTestBtn: boolean): SmartAssistantStartEvaluationActionITF {
    return {
      type: BOT_START_EVALUATION.REQUEST,
      data,
      isTestBtn
    }
  },
  dispatchAnswerQuestion(message: AssistantMsgITF, choice: ChoiceITF): SmartAssistantQuestionActionITF {
    return {
      type: BOT_ANSWER_QUESTION.REQUEST,
      message,
      choice
    }
  },
  dispatchEditAnswerQuestion(message: AssistantMsgITF, choice: ChoiceITF): SmartAssistantQuestionActionITF {
    return {
      type: BOT_EDIT_ANSWER_QUESTION.REQUEST,
      message,
      choice
    }
  }
}
